package bean.loader;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import bean.KoordinatBean;

public class KoordinatLoader implements BeanLoader<KoordinatBean>{

	@Override
	public List<KoordinatBean> loadList(ResultSet rs) throws SQLException {
		List<KoordinatBean> list = new ArrayList<KoordinatBean>();
		while(rs.next())
			list.add(loadSingle(rs));
		return list;
	}

	@Override
	public KoordinatBean loadSingle(ResultSet rs) throws SQLException {
		KoordinatBean bean = new KoordinatBean();
		bean.setId(rs.getInt("id_koord"));
//		bean.setLatitude(Double.valueOf(rs.getString("latitude")));
//		bean.setLongitude(Double.valueOf(rs.getString("longitude")));
		
		bean.setLatitude(rs.getDouble("latitude"));
		bean.setLongitude(rs.getDouble("longitude"));
		bean.setWesel(rs.getBoolean("wesel"));
		return bean;
	}

	@Override
	public PreparedStatement loadParameters(PreparedStatement ps,
			KoordinatBean bean) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

}
